<?php

global $_W, $_GPC;
			load()->func('tpl');
			$weid=intval($_W['uniacid']);
		$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
		if ($operation == 'display') {
			$pindex = max(1, intval($_GPC['page']));
            $psize = 10;
			 $sum =pdo_fetchcolumn("SELECT sum(pay_coll) FROM ".tablename('bbyscm_card_pay').$sql." limit ".$pindex * $psize, $params);
			 $sums =pdo_fetchcolumn("SELECT sum(yepay_coll) FROM ".tablename('bbyscm_card_pay').$sql." limit ".$pindex * $psize, $params);
			$list = pdo_fetchall("SELECT a.* FROM " . tablename('bbyscm_card_pay') . " as a WHERE a.uniacid = $weid $condition ORDER BY a.createtime DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
			$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('bbyscm_card_pay') . " as a WHERE a.uniacid = $weid  $condition");
            $pager = pagination($total, $pindex, $psize);
} elseif($op == 'change') {
    $id=intval($_GPC['id']);
    $status=$_GPC['status'];
    if($id){
        pdo_update('bbyscm_card_pay', array('status'=>$status), array('id'=>$id));
    }
    message('设置数据成功！', $this->createWebUrl('pays', array('op'=>'display')), 'success');
} elseif($op == 'del') {
    $id=intval($_GPC['id']);
    if($id){
        pdo_delete('bbyscm_card_pay', array('id' => $id));
    }
    message('删除数据成功！', $this->createWebUrl('pays', array('op'=>'display')), 'success');
}
include $this->template('web/pays');